#include<iostream>
#include<string>

using namespace std;

class MyStack;

class listNode{
    friend class MyStack;
private:
    listNode* next;
    int data;
    char op;
public:
    listNode(){next = NULL; data = 0; op = '\0';};
    listNode(int nodeData, listNode* succ = NULL) : data(nodeData), op('\0'), next(succ) {}

    listNode(char nodeData, listNode* succ = NULL) : op(nodeData), data(0), next(succ) {}
};

class MyStack
{
private:
    listNode* topNode;
    int stackSize;


public:
    MyStack();
    ~MyStack();

    bool push(const int&);
    bool push(const char&);
    bool pop(int&);
    bool pop(char&);
    bool getTop(int&);
    bool getTop(char&);
    void printStack();

    bool isEmpty();
};

class MyQueue
{
private:
    int* queue;
    int capacity;
    int front;
    int rear;

public:
    MyQueue(const int&);
    ~MyQueue();

    bool enQueue(const int&);
    bool deQueue(int&);
    bool getFront(int&);
    void printQueue();

    bool isFull();
};

bool postfixExpression(const string&, string&);

bool expressionVal(const string&, int&);

void yanghui(const int&);

